package com.xteam.xnetworkdisk.utils;

import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;

public class FFmpegUtils {

    public static void extractFirstFrame(String videoFilePath, String imageFilePath) throws IOException, InterruptedException {
        // 构建 FFmpeg 命令
        ProcessBuilder processBuilder = new ProcessBuilder(
                "ffmpeg",
                "-i", videoFilePath,
                "-ss", "00:00:01.000",
                "-vframes", "1",
                "-f", "image2",
                imageFilePath
        );

        // 启动 FFmpeg 进程
        Process process = processBuilder.start();
        process.waitFor();
    }
}
